WOLF core
WOLF: A Modular Estimation Framework for Robotics
XXXXXXXXXXXXXXXXXXXXXXXXvoid(0)" frameborder="0" name="MSearchResults" id="MSearchResults">
wolf::CaptureBase Class Reference

#include <core/capture/capture_base.h>

Inheritance diagram for wolf::CaptureBase:
[legend]

Public Member Functions

 CaptureBase (const std::string &_type, const TimeStamp &_ts, SensorBasePtr _sensor_ptr=nullptr, const TypeComposite &_state_types={}, const VectorComposite &_state_vectors={}, const PriorComposite &_state_priors={})
 Constructor. More...
 
 ~CaptureBase () override=default
 
void remove (bool viral_remove_parent_without_children=false) override
 Remove the capture. More...
 
bool hasChildren () const override
 Check if the capture has any children. More...
 
virtual FactorBasePtr emplaceDriftFactor (CaptureBasePtr _capture_origin, char _key, bool _apply_loss_function)
 Emplace a FactorBlockDifference with zero difference between the state _key of this capture and _capture_origin. More...
 
virtual bool isMotion () const
 Is a motion if there is motion detected. More...
 
bool process ()
 Process the capture. More...
 
unsigned int id () const override
 
TimeStamp getTimeStamp () const
 
void setTimeStamp (const TimeStamp &_ts)
 
void setTimeStampToNow ()
 
FrameBaseConstPtr getFrame () const
 
FrameBasePtr getFrame ()
 
FeatureBaseConstPtrList getFeatureList () const
 
FeatureBasePtrList getFeatureList ()
 
bool hasFeature (const FeatureBaseConstPtr &_feature) const
 
FactorBaseConstPtrList getFactorList () const
 
FactorBasePtrList getFactorList ()
 
void getFactorList (FactorBaseConstPtrList &_fac_list) const
 
void getFactorList (FactorBasePtrList &_fac_list)
 
SensorBaseConstPtr getSensor () const
 
SensorBasePtr getSensor ()
 
virtual void setSensor (const SensorBasePtr sensor_ptr)
 
StateBlockConstPtr getStateBlock (const char &_key) const override
 
StateBlockPtr getStateBlock (const char &_key) override
 
StateBlockConstPtr getSensorP () const
 
StateBlockPtr getSensorP ()
 
StateBlockConstPtr getSensorO () const
 
StateBlockPtr getSensorO ()
 
StateBlockConstPtr getSensorIntrinsic () const
 
StateBlockPtr getSensorIntrinsic ()
 
void fix () override
 
void unfix () override
 
void link (FrameBasePtr _frm_ptr)
 Link the capture to a frame. More...
 
virtual void printHeader (int depth, bool factored_by, bool metric, bool state_blocks, std::ostream &stream, std::string _tabs="") const
 Print the header information of the capture. More...
 
void print (int depth, bool factored_by, bool metric, bool state_blocks, std::ostream &stream=std::cout, std::string _tabs="") const
 Print the capture details. More...
 
virtual CheckLog localCheck (bool _verbose, std::ostream &_stream, std::string _tabs="") const
 Perform a local check on the capture. More...
 
bool check (CheckLog &_log, bool _verbose, std::ostream &_stream, std::string _tabs="") const
 Check the capture. More...
 
CaptureBasePtr shared_from_this_capture ()
 
CaptureBaseConstPtr shared_from_this_capture () const
 
- Public Member Functions inherited from wolf::NodeStateBlocks
 NodeStateBlocks (const std::string &_category, const std::string &_type, const TypeComposite &_state_types, const VectorComposite &_state_vectors, const PriorComposite &_state_priors)
 Constructor. More...
 
virtual ~NodeStateBlocks ()
 
virtual YAML::Node toYaml () const
 
StateKeys getKeys () const
 
TypeComposite getStateTypes () const
 
bool has (const char &_sb_key) const
 
bool has (const std::string &_keys) const
 
virtual unsigned int id () const =0
 
std::map< char, StateBlockConstPtr > getStateBlockMap () const
 
std::map< char, StateBlockPtr > getStateBlockMap ()
 
std::vector< StateBlockConstPtr > getStateBlockVec () const
 
std::vector< StateBlockPtr > getStateBlockVec ()
 
StateBlockConstPtr getP () const
 
StateBlockConstPtr getO () const
 
StateBlockPtr getP ()
 
StateBlockPtr getO ()
 
virtual void fix ()
 
virtual void unfix ()
 
virtual bool isFixed () const
 
StateBlockPtr emplaceStateBlock (const char key, const std::string &_type, const Eigen::VectorXd &_vector, const bool &_fixed)
 Emplace a state block. More...
 
StateBlockPtr emplaceStateBlockZero (const char key, const std::string &_type, const bool &_fixed)
 Emplace a state block with zero state. More...
 
bool hasStateBlock (const StateBlockConstPtr &_sb) const
 
bool setStateBlock (const char _sb_key, const StateBlockPtr &_sb)
 
bool stateBlockKey (const StateBlockConstPtr &_sb, char &_key) const
 
virtual StateBlockConstPtr getStateBlock (const char &_sb_key) const
 
virtual StateBlockPtr getStateBlock (const char &_sb_key)
 
void setProblem (ProblemPtr _problem) override
 
virtual void remove (bool viral_remove_parent_without_children=false)
 
bool hasChildren () const override
 
void emplaceFactorStateBlock (const char &_key, const Eigen::VectorXd &_x, const Eigen::MatrixXd &_cov, unsigned int _start_idx=0)
 Add an absolute factor to a parameter. More...
 
void emplacePriors ()
 
FactorBaseConstPtrSet getFactoredBySet () const
 
FactorBasePtrSet getFactoredBySet ()
 
void getFactoredBySet (FactorBaseConstPtrSet &_fac_set) const
 
void getFactoredBySet (FactorBasePtrSet &_fac_set)
 
FactorBaseConstPtrSet getSensoryFactorSet () const
 
FactorBasePtrSet getSensoryFactorSet ()
 
std::map< char, FactorBaseConstPtr > getPriorFactorMap () const
 
std::map< char, FactorBasePtr > getPriorFactorMap ()
 
FactorBaseConstPtr getPriorFactor (char) const
 
FactorBasePtr getPriorFactor (char)
 
FactorBaseConstPtrList getFactorsOf (ProcessorBaseConstPtr _processor_ptr, const std::string &type="") const
 
FactorBasePtrList getFactorsOf (ProcessorBasePtr _processor_ptr, const std::string &type="")
 
bool hasFactor (FactorBaseConstPtr _fac) const
 
VectorComposite getState (const StateKeys &_keys="") const
 
void setState (const VectorComposite &_state, const bool _notify=true)
 
void setState (const Eigen::VectorXd &_state, const StateKeys &_keys, const std::list< SizeEigen > &_sizes, const bool _notify=true)
 
void setState (const Eigen::VectorXd &_state, const StateKeys &_keys, const bool _notify=true)
 
void setState (const StateKeys &_keys, const std::list< Eigen::VectorXd > &_vectors, const bool _notify=true)
 
Eigen::VectorXd getStateVector (const StateKeys &_keys) const
 
unsigned int getSize (const StateKeys &_keys="") const
 
unsigned int getLocalSize (const StateKeys &_keys="") const
 
bool getCovariance (const StateKeys &_keys, Eigen::MatrixXd &_cov) const
 
void perturb (double amplitude=0.01)
 perturb all states states with random noise following an uniform distribution in [ -amplitude, amplitude ] More...
 
bool isCapture () const
 
bool isFrame () const
 
bool isLandmark () const
 
bool isSensor () const
 
- Public Member Functions inherited from wolf::NodeBase
 NodeBase (const std::string &_category, const std::string &_type="Undefined", const std::string &_name="")
 
virtual ~NodeBase ()=default
 
unsigned int nodeId () const
 
std::string getCategory () const
 
std::string getType () const
 
std::string getName () const
 
bool isRemoving () const
 
virtual bool hasChildren () const =0
 
void setType (const std::string &_type)
 
void setName (const std::string &_name)
 
ProblemConstPtr getProblem () const
 
ProblemPtr getProblem ()
 

Static Public Member Functions

template<typename classType , typename... T>
static std::shared_ptr< classType > emplace (FrameBasePtr _frm_ptr, T &&... all)
 Emplace a new capture of type classType. More...
 

Protected Member Functions

void setProblem (ProblemPtr _problem) override final
 
- Protected Member Functions inherited from wolf::NodeStateBlocks
virtual void removeStateBlock (const char &_sb_key)
 
void transform (const VectorComposite &_transformation)
 
void printState (bool _factored_by, bool _metric, bool _state_blocks, std::ostream &_stream, std::string _tabs) const
 
CheckLog localCheck (bool _verbose, std::ostream &_stream, std::string _tabs) const
 
virtual void setProblem (ProblemPtr _prob_ptr)
 

Protected Attributes

unsigned int capture_id_
 
TimeStamp time_stamp_
 Time stamp. More...
 
- Protected Attributes inherited from wolf::NodeBase
ProblemWPtr problem_ptr_
 
unsigned int node_id_
 Node id. It is unique over the whole Wolf Tree. More...
 
std::string node_category_
 Text label identifying the category of node ("SENSOR", "FEATURE", etc) More...
 
std::string node_type_
 Text label identifying the type or subcategory of node ("Pin Hole", "Point 2d", etc) More...
 
std::string node_name_
 
bool is_removing_
 A flag for safely removing nodes from the Wolf tree. See remove(). More...
 

Friends

class FeatureBase
 
class FactorBase
 
class FrameBase
 

Constructor & Destructor Documentation

◆ CaptureBase()

wolf::CaptureBase::CaptureBase ( const std::string &  _type,
const TimeStamp &  _ts,
SensorBasePtr  _sensor_ptr = nullptr,
const TypeComposite &  _state_types = {},
const VectorComposite &  _state_vectors = {},
const PriorComposite &  _state_priors = {} 
)

Constructor.

Parameters
_typeTO BE HARDCODED IN THE DERIVED CLASS CONSTRUCTOR: derived type name
_tsTimeStamp of the capture.
_sensor_ptrPointer to the sensor that produced the capture. If unknown: nullptr.
_state_typesComposite of types of the states that the capture can have. Probably to be hardcoded in the derived class constructor.
_state_vectorsComposite of vectors of the states of the capture. A 'StateBlock' for each key in '_state_vectors' will be emplaced (of the type specified in '_state_types'). Not all keys of '_state_types' are required to be specified, but all keys of '_state_vectors' should be in '_state_types'.
_state_priorsComposite of priors (initial_guess, factor or fixed) of the states of the capture. Not all keys of '_state_vectors' are required to be specified, but all keys of '_state_priors' should be in '_state_vectors'.

◆ ~CaptureBase()

wolf::CaptureBase::~CaptureBase ( )
overridedefault

Member Function Documentation

◆ check()

bool wolf::CaptureBase::check ( CheckLog &  _log,
bool  _verbose,
std::ostream &  _stream,
std::string  _tabs = "" 
) const

Check the capture.

Parameters
_logThe log to store check results.
_verboseWhether to enable verbose output.
_streamThe output stream to print to.
_tabsThe tabs to use for indentation.
Returns
true if the check is successful, false otherwise

◆ emplace()

template<typename classType , typename... T>
std::shared_ptr< classType > wolf::CaptureBase::emplace ( FrameBasePtr  _frm_ptr,
T &&...  all 
)
static

Emplace a new capture of type classType.

Parameters
_frm_ptrPointer to the frame to link the new capture to.
allVariadic template arguments to forward to the constructor of classType.
Returns
A shared pointer to the newly created capture.

◆ emplaceDriftFactor()

FactorBasePtr wolf::CaptureBase::emplaceDriftFactor ( CaptureBasePtr  _capture_origin,
char  _key,
bool  _apply_loss_function 
)
virtual

Emplace a FactorBlockDifference with zero difference between the state _key of this capture and _capture_origin.

Parameters
_capture_originThe origin capture to add the factor drift.
_keyThe key of the state to be factored.
_apply_loss_functionWhether to apply a loss function to the factor.

◆ fix()

void wolf::CaptureBase::fix ( )
overridevirtual

Reimplemented from wolf::NodeStateBlocks.

◆ getFactorList() [1/4]

FactorBasePtrList wolf::CaptureBase::getFactorList ( )

◆ getFactorList() [2/4]

FactorBaseConstPtrList wolf::CaptureBase::getFactorList ( ) const

◆ getFactorList() [3/4]

void wolf::CaptureBase::getFactorList ( FactorBaseConstPtrList &  _fac_list) const

◆ getFactorList() [4/4]

void wolf::CaptureBase::getFactorList ( FactorBasePtrList &  _fac_list)

◆ getFeatureList() [1/2]

FeatureBasePtrList wolf::CaptureBase::getFeatureList ( )
inline

◆ getFeatureList() [2/2]

FeatureBaseConstPtrList wolf::CaptureBase::getFeatureList ( ) const
inline

◆ getFrame() [1/2]

FrameBasePtr wolf::CaptureBase::getFrame ( )
inline

◆ getFrame() [2/2]

FrameBaseConstPtr wolf::CaptureBase::getFrame ( ) const
inline

◆ getSensor() [1/2]

SensorBasePtr wolf::CaptureBase::getSensor ( )
inline

◆ getSensor() [2/2]

SensorBaseConstPtr wolf::CaptureBase::getSensor ( ) const
inline

◆ getSensorIntrinsic() [1/2]

StateBlockPtr wolf::CaptureBase::getSensorIntrinsic ( )
inline

◆ getSensorIntrinsic() [2/2]

StateBlockConstPtr wolf::CaptureBase::getSensorIntrinsic ( ) const
inline

◆ getSensorO() [1/2]

StateBlockPtr wolf::CaptureBase::getSensorO ( )
inline

◆ getSensorO() [2/2]

StateBlockConstPtr wolf::CaptureBase::getSensorO ( ) const
inline

◆ getSensorP() [1/2]

StateBlockPtr wolf::CaptureBase::getSensorP ( )
inline

◆ getSensorP() [2/2]

StateBlockConstPtr wolf::CaptureBase::getSensorP ( ) const
inline

◆ getStateBlock() [1/2]

StateBlockConstPtr wolf::CaptureBase::getStateBlock ( const char &  _key) const
overridevirtual

Reimplemented from wolf::NodeStateBlocks.

◆ getStateBlock() [2/2]

StateBlockPtr wolf::CaptureBase::getStateBlock ( const char &  _key)
overridevirtual

Reimplemented from wolf::NodeStateBlocks.

◆ getTimeStamp()

TimeStamp wolf::CaptureBase::getTimeStamp ( ) const
inline

◆ hasChildren()

bool wolf::CaptureBase::hasChildren ( ) const
overridevirtual

Check if the capture has any children.

Returns
true if the capture has children, false otherwise

Implements wolf::NodeBase.

◆ hasFeature()

bool wolf::CaptureBase::hasFeature ( const FeatureBaseConstPtr &  _feature) const

◆ id()

unsigned int wolf::CaptureBase::id ( ) const
inlineoverridevirtual

Implements wolf::NodeStateBlocks.

◆ isMotion()

bool wolf::CaptureBase::isMotion ( ) const
inlinevirtual

Is a motion if there is motion detected.

Returns
true if the capture is of type motion, false otherwise.

Reimplemented in wolf::CaptureMotion.

◆ link()

void wolf::CaptureBase::link ( FrameBasePtr  _frm_ptr)

Link the capture to a frame.

Parameters
_frm_ptrPointer to the frame.

◆ localCheck()

CheckLog wolf::CaptureBase::localCheck ( bool  _verbose,
std::ostream &  _stream,
std::string  _tabs = "" 
) const
virtual

Perform a local check on the capture.

Parameters
_verboseWhether to print verbose output.
_streamThe output stream to print to.
_tabsThe tabs to use for indentation.
Returns
A CheckLog object containing the results of the check.

◆ print()

void wolf::CaptureBase::print ( int  depth,
bool  factored_by,
bool  metric,
bool  state_blocks,
std::ostream &  stream = std::cout,
std::string  _tabs = "" 
) const

Print the capture details.

Parameters
depthThe depth of the print.
factored_byWhether to include factors in the print.
metricWhether to include metric information.
state_blocksWhether to include state blocks.
streamThe output stream to print to.
_tabsThe tabs to use for indentation.

◆ printHeader()

void wolf::CaptureBase::printHeader ( int  depth,
bool  factored_by,
bool  metric,
bool  state_blocks,
std::ostream &  stream,
std::string  _tabs = "" 
) const
virtual

Print the header information of the capture.

Parameters
depthThe depth of the header.
factored_byWhether to include factors in the print.
metricWhether to print metric information.
state_blocksWhether to print state blocks information.
streamThe output stream to print to.
_tabsThe tabs to use for indentation.

Reimplemented in wolf::CaptureMotion.

◆ process()

bool wolf::CaptureBase::process ( )

Process the capture.

Returns
true if the process is successful, false otherwise

◆ remove()

void wolf::CaptureBase::remove ( bool  viral_remove_parent_without_children = false)
overridevirtual

Remove the capture.

Parameters
viral_remove_parent_without_childrenIf true, removes the parent if it has no other children.

Reimplemented from wolf::NodeStateBlocks.

◆ setProblem()

void wolf::CaptureBase::setProblem ( ProblemPtr  _problem)
finaloverrideprotectedvirtual

Reimplemented from wolf::NodeBase.

◆ setSensor()

void wolf::CaptureBase::setSensor ( const SensorBasePtr  sensor_ptr)
inlinevirtual

◆ setTimeStamp()

void wolf::CaptureBase::setTimeStamp ( const TimeStamp &  _ts)
inline

◆ setTimeStampToNow()

void wolf::CaptureBase::setTimeStampToNow ( )
inline

◆ shared_from_this_capture() [1/2]

CaptureBasePtr wolf::CaptureBase::shared_from_this_capture ( )
inline

◆ shared_from_this_capture() [2/2]

CaptureBaseConstPtr wolf::CaptureBase::shared_from_this_capture ( ) const
inline

◆ unfix()

void wolf::CaptureBase::unfix ( )
overridevirtual

Reimplemented from wolf::NodeStateBlocks.

Friends And Related Function Documentation

◆ FactorBase

friend class FactorBase
friend

◆ FeatureBase

friend class FeatureBase
friend

◆ FrameBase

friend class FrameBase
friend

Member Data Documentation

◆ capture_id_

unsigned int wolf::CaptureBase::capture_id_
protected

◆ time_stamp_

TimeStamp wolf::CaptureBase::time_stamp_
protected

Time stamp.


The documentation for this class was generated from the following files: